<template>
    <div class="userlist">         
            <mt-checklist
                align="right"
                v-model="value"
                :options="options">
            </mt-checklist>
        <!-- <mt-button type="primary" size="large" plain @click="moreInfo">加载更多</mt-button> -->
    </div>
</template>

<script>
    import {Toast} from 'mint-ui'
    import { Checklist } from 'mint-ui';
    import { Indicator } from 'mint-ui';
    export default {
        data() {
            return {
                value : [],
                options: [],
            }
        },
        mounted() {
            Indicator.open({
                text: '加载中...',
                spinnerType: 'fading-circle'
            }); 
        },
        created() {
            this.gettestdate();     
        },
        watch: {
            value(value){
                console.log(value);
                this.$store.state.value = value;
            }
        },
        methods: {
            gettestdate(){
                this.axios.post('http://zxdc.catsic.com:9090/sampling/scheme/getReportSampleList', {
                            'data': {
                                 "name":  localStorage.getItem("userName"),
                                    }
                            }, {
                            'headers': {
                                    'Content-Type': 'application/json',
                                    'mobileHeader': '{"sessionId":' + localStorage.getItem('sessionId') + '}'
                                    }
                                }).then(result=>{
                                    if (result.data.status === "1000"){
                                        Indicator.close();
                                        Toast("获取上报列表成功");
                                            result.data.data.reportListVO.forEach(item => {
                                                if (item.samplestatus != "已上报"&&item.reportedByOther == 1) {
                                                    this.options.push(item);
                                                }
                                        })
                                        console.log(this.options);
                                        //this.options.push(result.data.data.reportListVO);
                                        console.log(result);
                                    }else if(result.data.status === "1001"){
                                        Indicator.close();
                                        Toast(result.data.msg);
                                    }else if(result.data.status == "4001"||result.data.status == "5005"||result.data.status == "1002"){
                                        Indicator.close();
                                        this.dateFlag = true;
                                        this.sessionId = "";
                                        localStorage.setItem('sessionId', JSON.stringify(this.sessionId));
                                        this.$store.commit("outLogin");
                                        this.msg = result.data.msg;
                                        Toast(this.msg);
                                        this.$router.push({
                                            path:'/login'
                                                });
                                     }else if(result.data.status === "5001"){
                                        Indicator.close();
                                        Toast(result.data.msg);
                                     }      
                    }); 
            },
            // moreInfo(){
            //         this.pageNum++;
            //         this.gettestdate();
            //         console.log(this.pageNum);
            // },
        },
    }
</script>

<style lang="scss" scoped>
    mt-header {
        z-index: 999;
        /*padding-top: 20px;*/
    }

    .mint-header {
        height: 40px;
        /*padding-top: 30px;*/
    }

    .userlist {

        height: 100%;
        width: 100%;
        /*padding-top: 80px;*/
        padding-top: 2px;

        /*padding-top: 20px;*/
        .fonts {
            font-size: 14px;
            color: #226aff;
            /* display: flex;
            justify-content:space-between; */
            /* margin: 0 10% 0 50%;
            display: inline-block;   */
            float: right;
        }
        .time {
            font-size: 14px;
            color: #226aff;
            margin: 0 0 0 5%;
        }
        .sbqk {
            font-size: 14px;
            color: #226aff;
            margin: 0 5% 0 60%;
        }
        .company {
            font-size: 16px;
            color: #030303;
        }
        .mui-table-view-cell > a:not(.mui-btn).mui-active {
            background-color: #fff;
        }
    }
</style>